// Flamethrower (UTNT)

ACTOR IDMFlamethrower : IDMWeapon
{
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "Flamethrower! (Slot 7)"
  Tag "Flamethrower"
  Weapon.AmmoType "IDMGas"
  //Weapon.PreferredSkin "FlamerMarine"
  Weapon.Sisterweapon "FlamethrowerLevel2"
  Weapon.SelectionOrder 50
  Weapon.AmmoGive 100
  Weapon.AmmoUse 1
  +Weapon.Explosive
  +Weapon.BFG
  +WEAPON.NOLMS
  States
  {
  Spawn:
    WFLM A -1 Bright
    Stop
  Ready:
    FLMG BCD 3 A_WeaponReady
    Loop
  Deselect:
    FLMG A 1 A_Lower
    Loop
  Select:
    TNT1 A 0 A_Playsound("Flamethrower/Equip",CHAN_AUTO)
	TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
  Sloop:
    FLMG A 1 A_Raise
    Loop
  Fire:
    FLMG A 10 A_Playsound("FlameThrower/Start",CHAN_AUTO)
  Hold:
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Playsound("Flamethrower/Loop",CHAN_WEAPON)
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG E 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG F 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG G 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG E 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG F 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG G 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG E 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
    FLMG F 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG G 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
    FLMG H 2 bright A_ReFire("Hold2")
	Goto FireEnd
  Hold2:
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad2")
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG E 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG F 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG G 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG E 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG F 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG G 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
    TNT1 A 0 A_GunFlash
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG E 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
	TNT1 AA 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG F 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
	TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	TNT1 A 0 A_FireCustomMissile("FTFire", frandom(-10, 10), 0, frandom(-4, 4), 0)
    FLMG G 1 bright A_FireCustomMissile("FTFire", frandom(-10, 10), 1, frandom(-4, 4), 0)
    FLMG H 2 bright A_ReFire("Hold")
  FireEnd:
	FLMG A 6 A_Playsound("FlameThrower/End",CHAN_WEAPON)
	FLMG BCD 3
	TNT1 A 0 A_Refire("Fire")
    Goto Ready
  Quad:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
	Goto Hold+3
  Quad2:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
	Goto Hold2+2
  Flash:
    TNT1 A 2 A_Light1
    TNT1 A 2 A_Light2
    TNT1 A 1 A_Light1
    TNT1 A 1 A_Light0
    Stop
  }
}

ACTOR FlamethrowerLevel2 : IDMFlamethrower
{
	+POWERED_UP
	Weapon.Sisterweapon "IDMFlamethrower"
	Weapon.AmmoUse 30
	States
	{
    Ready:
      FLMG BCD 3 A_WeaponReady
      Loop
	Deselect:
      FLMG A 1 A_Lower
      Loop
	Select:
      TNT1 A 0 A_Playsound("Flamethrower/Equip",CHAN_AUTO)
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
      FLMG A 1 A_Raise
      Loop
	Fire:
	  TNT1 A 0 A_GunFlash
      FLMG A 8 A_Playsound("FlameThrower/Start",CHAN_AUTO)
	  FLMG E 2 Bright Offset(0,39)
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
	  FLMG F 2 Bright Offset(0,45) A_FireCustomMissile("FTFireBall",0,1)
	  FLMG G 2 Bright Offset(0,41)
	  FLMG H 2 Bright Offset(0,39) A_Playsound("FlameThrower/End",CHAN_WEAPON)
	  FLMG A 2 Offset(0,37)
	  FLMG A 3 Offset(0,35)
	  FLMG A 4 Offset(0,33)
	  FLMG BCDBCDBCD 3
	  FLMG A 5 A_Refire("Fire")
	  Goto Ready
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_AUTO)
	  FLMG F 2 Bright Offset(0,45) A_FireCustomMissile("ExtremeFTFireBall",0,1)
	  Goto Fire+5
	}
}

Actor FTFire
{
  Radius 2
  Height 4
  Speed 48
  Projectile
  RenderStyle Add
  DamageType Fire
  Alpha 0.67
  Scale 0.67
  +RIPPER
  +NODAMAGETHRUST
  +BLOODLESSIMPACT
  +SKYEXPLODE
  -NOTELEPORT
  +EXTREMEDEATH
  DeathSound "Flamethrower/Hit"
  Obituary "%o was barbecued by %k's Flamethrower."
  States
  {
  Spawn:
    TNT1 AA 1 A_Explode(8*random(1,5), 8, 0)
    FRFX AABBCCDD 1 bright A_Explode(8*random(1,5), 8, 0)
    TNT1 A 0 A_LowGravity
    FRFX EEFFGG 1 bright A_Explode(8*random(1,5), 16, 0)
    FRFX HHIIJJ 1 bright A_Explode(8*random(1,5), 32, 0)
    FRFX KKLLMM 1 bright A_Explode(8*random(1,5), 64, 0)
    FRFX NO 2 bright
    Stop
  Death:
    FRFX HIJ 2 bright A_Explode(8*random(1,5), 32, 0)
    TNT1 A 0 A_CustomMissile("DropFire", 0, 0, 0, CMF_TRACKOWNER)
    FRFX KLM 2 bright A_Explode(8*random(1,5), 64, 0)
    FRFX NO 2 bright
    Stop
  }
}

ACTOR DropFire
{
  Radius 8
  Height 40
  Projectile
  RenderStyle Add
  DamageType Fire
  Alpha 0.8
  -NoGravity
  +LowGravity
  +NoExplodeFloor
  +NoDamageThrust
  +SKYEXPLODE
  -NOTELEPORT
  +EXTREMEDEATH
  +DONTSPLASH
  Obituary "%o was barbecued by %k's Flamethrower."
  SelfObituary "%o let %p Flamethrower fire spread on %hself."
  States
  {
  Spawn:
    TNT1 A 0 A_PlaySound("Flamethrower/Flame")
    FLME ABCDEFGHIJKLMN 2 bright A_Explode(4*random(1,10), 16, 0)
    TNT1 A 0 A_PlaySound("Flamethrower/Flame")
    FLME ABCDEFGHIJKLMN 2 bright A_Explode(4*random(1,5), 16, 0)
    TNT1 A 0 A_Jump(128, "Death")
    Loop
  Death:
    TNT1 A 1
    Stop
  }
}

ACTOR FTFireBall
{
	Radius 5
	Height 5
	Speed 45
	Damage 100
	Projectile
	DamageType Fire
	Alpha 1.0
	Seesound "Flamethrower/Fireball"
	DeathSound "MageStaffExplode"
    +SKYEXPLODE
    -NOTELEPORT
	+EXTREMEDEATH
	States
	{
	Spawn:
	  TNT1 A 0
      FTBL AB 1 Bright A_CustomMissile("FTFire3",0,0,frandom(0,359),CMF_TRACKOWNER)
	  Loop
	Death:
      TNT1 A 0
	  TNT1 A 0 A_Explode(100,100)
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL C 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL C 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL C 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL C 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL C 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL C 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL D 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL D 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL D 1 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  TNT1 AAAAAAAAAA 0 A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL D 3 Bright A_CustomMissile("FTFire2",16,0,frandom(0,359),CMF_AIMDIRECTION|CMF_TRACKOWNER,frandom(-15,45))
	  FTBL F 6 Bright
	  FTBL G 6 Bright
	  FTBL H 5 Bright
	  FTBL I 5 Bright
	  Stop
  }
}

ACTOR ExtremeFTFireBall : FTFireBall
{
	States
	{
    XDeath:
	  TNT1 A 0
	  TNT1 AAA 0 A_Playsound("misc/crit",CHAN_AUTO)
	  Goto Death
	}
}

ACTOR FTFire2 : FTFire
{
	Speed 25
	Gravity 0.9
	Damage 25
	-NOGRAVITY
    +SKYEXPLODE
    -NOTELEPORT
	States
	{
	Spawn:
      TNT1 AA 1 A_Explode(4*random(1,10), 8, 0)
      FRFX AABBCCDD 1 bright A_Explode(4*random(1,10), 8, 0)
      FRFX EEFFGG 1 bright A_Explode(4*random(1,10), 16, 0)
      FRFX HHIIJJ 1 bright A_Explode(4*random(1,10), 32, 0)
      FRFX KKLLMM 1 bright A_Explode(4*random(1,10), 64, 0)
      FRFX NO 2 bright
      Stop
	}
}

ACTOR FTFire3 : FTFire2
{
	Speed 5
}